package gold.digger;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC524 {
    public long startExecuteTime = System.currentTimeMillis();

    /**
     * 感觉这题挺简单的啊
     */
    public class Solution {
        public boolean isSubsequence(String x, String y) {
            int j = 0;
            for (int i = 0; i < y.length() && j < x.length(); i++)
                if (x.charAt(j) == y.charAt(i))
                    j++;
            return j == x.length();
        }

        public String findLongestWord(String s, List<String> d) {
            String max_str = "";
            for (String str : d) {
                if (isSubsequence(str, s)) {
                    if (str.length() > max_str.length() || (str.length() == max_str.length() && str.compareTo(max_str) < 0))
                        max_str = str;
                }
            }
            return max_str;
        }
    }

    public void run() {
        Solution solution = new Solution();
        List<Integer> list = new ArrayList<>();
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC524 an = new LC524();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
